@keyframes blinky {
    from {opacity: 0;}
    to {opacity: 1;}
}

$menuWidth: 15em;

body {
    background: #00309a;
    background: linear-gradient(to right, rgba(0,48,154,1) 0%,rgba(0,22,91,1) 100%);
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}
.header {
    background: rgba(255,255,255,0.2);
    padding: 1em;
    color: white;
}
.page {
    margin: 1em;
    padding: 1em;
    background: rgba(255,255,255,0.75);
    transition: margin-left 0.15s ease-out;
}

.menu {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    left: 1em;
    width: $menuWidth;
    height: 0;
    overflow-y: visible;
    box-sizing: border-box;
    
    .miniheader {
        background: #a3aaffeb;
        text-align: center;
        font-weight: bold;
        padding-top: 0.6em;
        padding-bottom: 0.6em;
        margin-top: 1em;
    }
    
    .menubar {
        display: flex;
        flex-direction: column;
    }

    .toolbox [data-type] {
        padding: 0.5em;
        cursor: grab;

        .help {
            position: absolute;
            display: none;
            background: white;
            border: 1px solid black;
            max-width: 15em;
            padding: 0.5em;
            z-index: 1000;
            pointer-events: none;
            left: 1em;
            top: 2em;
        } 
        
        &:hover .help {
            display: block;
        }
    }
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    
    button {
        padding: 0.5em;
    }
    
    .existing {
        h1, h2 {
            margin-top: 0;
        }
        
        display: flex;
        width: 100%;
        max-width: 70em;
        margin-left: auto;
        margin-right: auto;        
        
        &>div {
            width: 33%;
            max-width: 45em;
            box-sizing: border-box;
            background: rgba(0,0,100,0.1);
            border: 1px solid rgba(0,0,0,0.1);
            margin: 1em;
            padding: 1em;
            display: flex;
            flex-direction: column;            
            
            button {
                margin-top: 1em;                
            }
        }
    }
}

label, .label {
    font-weight: bold;
    display: inline-block;
    padding: 1em;
    padding-top: 0.25em;
    width: 8em;
    
    .help {
        position: absolute;
        display: none;
        background: white;
        border: 1px solid black;
        max-width: 15em;
        padding: 0.5em;
        z-index: 1000;
	    pointer-events: none;
    } 
    
    &:hover .help {
        display: block;
    }
}


/** Data layouting **/
[data-type]{
    position: relative;
    border: 1px dotted grey;
    display: grid;
    grid-template-columns: auto 1fr;
    
    &[data-type='cmp'] {
        border: 0;
        padding: 0;
    }
    &[data-type='action'] {background: greenyellow}
    &[data-type='matcher'] {background: mediumslateblue}
    &[data-type='detector'] {background: turquoise}
    &[data-type='method'] {
        display: block;
        border: none;
        margin-bottom: 1em;
        [data-bind~="name"] {
            display: block;
            font-weight: bold;

            &.customMethod {
                color: blue;
            }
        }
    }
    &[data-type='consent'] {background: orchid}
    &[data-type='domSelector'] {background: khaki}        
}
[data-bind="detectors"] {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 1em;
    [data-type='detector'] {
        margin-right: 1em;
    }
}
[data-bind="methods"] {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

[data-fold-name] {
    &:before {
        grid-column: span 2;    
        content: "▾\00a0" attr(data-fold-name) attr(data-fold-extra-name);
        display: block;
        padding: 0.25em;
        padding-left: 1em;
        background: rgba(0,0,0,0.2);
        cursor: move;
    }
    
    &.toggled {
        &:before {
            content: "▸\00a0" attr(data-fold-name) attr(data-fold-extra-name);
        }        
        * {
            display: none !important;
        }
    }    
}
[data-plug] {
    position: relative;
    
    &[data-multiple='true'].droppable-active {
        filter: brightness(1.2);
        &:hover {
            filter: brightness(1.3);
        }    
    }    
    
    &:empty {
        &.droppable-hover {            
            opacity: 1;            
            
            &:after {
                border: 2px green solid !important;
            }
        }
        
        &.droppable-active {
            &:after {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                content: "";
                background: rgba(0,0,0,0.2);
                pointer-events: none; 
                border: 2px solid black;
                animation: blinky 0.5s ease-in-out alternate infinite;
            }
            &:hover:after {
                background: rgba(20,255,100,0.6);
            }    
        }
    }

    .list {
        list-style: none;
        padding-inline-start: 0px;
        margin: 0;
    }
}

div.step1, div.step2, div.step3, div.step4 {
    display: none;
}
body[data-view='step1'] div.step1, body[data-view='step2'] div.step2, body[data-view='step3'] div.step3, body[data-view='step4'] div.step4 {
    display: block;
}
body[data-view='step3'] .page {
    margin-left: 2em + $menuWidth;
}

div[data-plug]:empty {
    background: orange;
    min-height: 3em;
    min-width: 5em;
    display: inline-block;
    position: relative;
}

.target.toggled div {
    display: none !important;
}

.parent.toggled div {
    display: none !important;
}

.draggable-clone {
    opacity: 0.4;
    position: absolute;
    top: 0;
    left: 0;

    .help {
        display: none;
    }
}

.step3 .rules {
    display: inline-block;
    min-width: 50%;
}

.toolbox .actions .action {
    display: inline-block;
}

.step3 h1 {
    margin-top: 0;
}

.step3 .trashcan {
    height: 6em;
    background: red;
    display: flex;
    flex-direction: column;
    justify-content: center;    
    align-items: center;
    text-align: center;
    display: none;
}

.step3 .trashcan.droppable-active {
    border: 2px red solid;
    display: block;
    opacity: 0.7;
}

.step3 .trashcan.droppable-hover {
    border: 2px green solid;
    opacity: 1;
}
